package com.chexiehui.jc.mvp.home;

import com.chexiehui.jc.Constants;
import com.chexiehui.jc.base.BaseModel;
import com.chexiehui.jc.base.BasePage;
import com.chexiehui.jc.base.BaseView;
import com.chexiehui.jc.entity.PostInfo;
import com.chexiehui.jc.entity.ShopInfo;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * @Description 首页4s店
 * @Auth SongJun
 * @Date 2019/11/20 10:05
 **/
public interface HomeSlideShopCovenant {

    interface View extends BaseView {
        void onGetWeatherInfoSuccess(BaseModel successResult);

        void onGetWeatherInfoFailure(BaseModel failureResult);

        void onGetShopListSuccess(BaseModel<BasePage<ShopInfo>> successResult);

        void onGetShopListFailure(BaseModel<Object> failureResult);

        void onGetPostListSuccess(BaseModel<List<PostInfo>> successResult);

        void onGetPostListFailure(BaseModel<Object> failureResult);

        void onDoDianZanSuccess(BaseModel<String> successResult);

        void onDoDianZanFailure(BaseModel<Object> failureResult);

        void onDoFollowPersonSuccess(BaseModel<String> successResult);

        void onDoFollowPersonFailure(BaseModel<Object> failureResult);

        String getLocationLat();

        String getLocationLng();

        String getLocationCity();
    }

    interface Stores {
        @GET
        Observable<BaseModel> getWeatherInfo(
                @Url String url,
                @Query("key") String key,
                @Query("city") String city);

        @FormUrlEncoded
        @POST(Constants.URL_HOME_SHOP_LIST)
        Observable<BaseModel<BasePage<ShopInfo>>> getShopList(
                @Field("lat") String lat,
                @Field("lng") String lng,
                @Field("cityName") String cityName,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize
        );

        @FormUrlEncoded
        @POST(Constants.URL_GET_POSTS_LIST_BY_DISTANCE)
        Observable<BaseModel<List<PostInfo>>> getPostList(
                @Field("lat") double lat, @Field("lng") double lng);


        @FormUrlEncoded
        @POST(Constants.URL_POST_DIAN_ZAN)
        Observable<BaseModel<String>> doDianZan(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

        @FormUrlEncoded
        @POST(Constants.URL_ADD_FOLLOW)
        Observable<BaseModel<String>> doFollowPerson(
                @Field("orgid") String orgid,
                @Field("type") String type
        );
    }

    interface Presenter {
        void getWeatherInfo(String cityName);
        void getShopList();

        void getPostList(double lat, double lng);

        void doDianZan(String objId);
        void doFollowPerson(String objId);
    }

}